"""
Case Type   : cm_ctl
Case Name   : 资源池化集群执行cm_ctl --help
Create At   : 2024/04/05
Owner       : @kyeleze
Description :
    1.执行cm_ctl --help
Expect      :
    1.帮助信息正确
History     :
"""

import os
import unittest
import time

from testcase.utils.CommonSH import CommonSH
from testcase.utils.Constant import Constant
from testcase.utils.Logger import Logger

primary_sh = CommonSH('PrimaryDbUser')


@unittest.skipIf(3 != primary_sh.get_node_num(), '非1+2环境不执行')
class CmPauseResumeCase(unittest.TestCase):
    def setUp(self):
        self.log = Logger()
        self.log.info(f'----{os.path.basename(__file__)} start----')
        self.constant = Constant()
        self.primary_sh = CommonSH('PrimaryDbUser')

    def test_cm(self):
        step = '--step1:执行cm_ctl --help expect:成功--'
        self.log.info(step)
        result = self.primary_sh.exec_cm_ctl('--help')
        self.log.info(result)
        self.assertIn('cm_ctl pause', result, "执行失败:" + step)
        self.assertIn('cm_ctl resume', result, "执行失败:" + step)

    def tearDown(self):
        self.log.info(f'----{os.path.basename(__file__)} end----')
